<template>
  <div>
    <el-form-item label="单位类型" prop="companyType">
      <el-select v-model="companyType" placeholder="请选择单位类型" @change="getValue">
        <el-option
          :label="item.name"
          :value="item.id"
          v-for="item in compnayTypeList"
          :key="item.id"
        ></el-option>
      </el-select>
    </el-form-item>
  </div>
</template>
<script>
export default {
  props: ["code"],
  data() {
    return {
      companyType: "",
      compnayTypeList: []
    };
  },
  created() {
    this.initCompanyType();
  },
  mounted() {
    // alert(this.defaultvalue);
    this.companyType =
      sessionStorage.types == 1
        ? "产废方"
        : sessionStorage.types == 2
        ? "处置方"
        : sessionStorage.types == 3
        ? "运输方"
        : sessionStorage.types == 4
        ? "运营方"
        : sessionStorage.types == 5
        ? "监管方"
        : sessionStorage.types == 6
        ? "管理员"
        : sessionStorage.types == 7
        ? "处置、运营"
        : "";
  },
  methods: {
    getValue(val) {
      this.companyType = val;
      this.$emit("selectChange", this.companyType);
    },
    initCompanyType() {
      this.$common.$ajax("/sys/company/type/list", {}, "get").then(res => {
        this.compnayTypeList = res.data.body;
      });
    }
  }
};
</script>


<style lang="scss" scoped>
</style>
